package com.chixing.day05_oop;

import com.chixing.day04_oop.Account;
import com.chixing.day04_oop.Bank;

public class AccountTest {
    public static void main(String[] args) {
        SavingAccount sa1 = new SavingAccount();
        sa1.setAccNo(622288888L);
        sa1.setAccName("smith");




        Dog dog =  new Dog();  // this dog is a Dog
        Animal an1 =  new Dog(); //this dog  is a Animal
        Object o1 =  new Dog();

        Animal an2 = new Animal();
        // Dog dog2 = new Animal();  // 编译错误 complier error (syntax error)

        // ClassCastException : 类转转异常
        // Dog dog2 =(Dog) an2; // error 强制类型转换  【an2 在堆内存中 是Animal 类型】

        Dog dog3 =(Dog) an1; // yes  an1 在堆中  new Dog() Dog类型
        System.out.println(dog3 instanceof  Dog);
        System.out.println(dog3 instanceof  Animal);



    }
}
class Animal{}
class Dog extends Animal{}




